package com.corpcredit.dao.util;

import javax.sql.DataSource;

import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

public class JdbcTemplateFactory {

    private static JdbcTemplate jdbcTemplate;
    
    static {
        ApplicationContext ctx = ApplicationContextFactory.getApplicationContext();
        DataSource ds = (DataSource) ctx.getBean("dataSource");
        jdbcTemplate = new JdbcTemplate(ds);
    }

    public static JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }
}
